import 'package:flutter/material.dart';
import 'package:flutter3x/route/route.dart';
import 'package:get/get.dart';

class LayoutDemo extends StatelessWidget {
  const LayoutDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      width: 200,
      color: const Color.fromARGB(255, 255, 255, 255),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          GestureDetector(
            onTap: () {
              Get.toNamed(RouteConfig.mdc);
            },
            child: ConstrainedBox(
              constraints: const BoxConstraints(
                minHeight: 200,
                maxWidth: 200,
              ),
              child: Container(
                color: const Color.fromARGB(255, 2, 31, 150),
                child: const AspectRotionDemo(),
              ),
            ),
          ),
        ],
      ),
    );
  }
}

class AspectRotionDemo extends StatelessWidget {
  const AspectRotionDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return AspectRatio(
      aspectRatio: 3 / 2,
      child: Container(
        color: const Color.fromARGB(170, 2, 153, 208),
        child: const Center(
          child:Text(
          '示例Demo',
          style: TextStyle(
            color: Colors.white,
            fontSize: 20,
            fontWeight: FontWeight.w900,
          ),
        ),
        )
        
      ),
    );
  }
}

class StackDemo extends StatelessWidget {
  const StackDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return Stack(
      alignment: Alignment.topLeft,
      children: <Widget>[
        SizedBox(
          width: 400,
          height: 550,
          child: Container(
            alignment: const Alignment(0.5, 0),
            decoration: BoxDecoration(
              color: const Color.fromARGB(255, 2, 31, 150),
              borderRadius: BorderRadius.circular(8),
            ),
          ),
        ),
        const SizedBox(
          height: 20,
        ),
        SizedBox(
          width: 100,
          height: 100,
          child: Container(
              decoration: const BoxDecoration(
                color: Color.fromARGB(255, 32, 32, 33),
                shape: BoxShape.circle,
                gradient: RadialGradient(colors: [
                  Color.fromRGBO(55, 131, 252, 1),
                  Color.fromRGBO(3, 32, 150, 0.348),
                ]),
              ),
              child: const Icon(
                Icons.brightness_2,
                color: Colors.white,
                size: 32,
              )),
        ),
        const Positioned(
          right: 20,
          top: 20,
          child: Icon(
            Icons.ac_unit,
            color: Color.fromARGB(255, 255, 255, 255),
            size: 32,
          ),
        ),
        const Positioned(
          right: 70,
          top: 80,
          child: Icon(
            Icons.ac_unit,
            color: Color.fromARGB(255, 255, 255, 255),
            size: 22,
          ),
        ),
        const Positioned(
          right: 5,
          top: 120,
          child: Icon(
            Icons.ac_unit,
            color: Color.fromARGB(255, 255, 255, 255),
            size: 25,
          ),
        ),
        const Positioned(
          right: 90,
          top: 130,
          child: Icon(
            Icons.ac_unit,
            color: Color.fromARGB(255, 255, 255, 255),
            size: 19,
          ),
        ),
        const Positioned(
          right: 54,
          top: 190,
          child: Icon(
            Icons.ac_unit,
            color: Color.fromARGB(255, 255, 255, 255),
            size: 22,
          ),
        ),
        const Positioned(
          right: 54,
          top: 390,
          child: Text(
            '示例Demo',
            style: TextStyle(
              color: Colors.white,
              fontSize: 20,
            ),
          ),
        ),
      ],
    );
  }
}

class IconBadge extends StatelessWidget {
  final IconData icon;
  final double size;

  const IconBadge(this.icon, {super.key, this.size = 32.0});

  @override
  Widget build(BuildContext context) {
    return Container(
      width: size + 60,
      height: size + 60,
      color: const Color.fromRGBO(3, 54, 255, 1),
      child: Icon(
        icon,
        size: size,
        color: Colors.white,
      ),
    );
  }
}
